//===============================================================================
// Jeff Barnes - 02/16/2007
// WCF Callback Sample
// http://blog.jeffbarnes.net
// http://jeffbarnes.net/portal/blogs/jeff_barnes/contact.aspx
//
// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY
// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT
// LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
// FITNESS FOR A PARTICULAR PURPOSE.
//===============================================================================

using System;
using System.ServiceModel;
using SLS.ExClassLib;
using SLS.ExClassLib.Message;

namespace SLS.ExClassLib.RTIServiceContract
{
    // NOTE: The use of one way service operations allows the callback to occur while
    //       still using the single concurrency mode rather than Reentrant or Multiple.

    /// <summary>
    /// Beer Inventory Service Operations
    /// </summary>
    [ServiceContract(
        Name = "RTIService",
        Namespace = "http://CallBack/RTIService/",
        SessionMode = SessionMode.Required,
        CallbackContract = typeof(IRTIServiceContractCallBack))]
    public interface IRTIServiceContract
    {
        [OperationContract(IsOneWay = true)]
        void SendMAMessage(MessageEx msg); 
        /// <summary>
        /// Subcribes a client for any message broadcast.
        /// </summary>
        /// <returns>An id that will identify a client.</returns>
        [OperationContract()]
        string Subscribe();
        [OperationContract()]
        MessageEx GetRTITimeStamp(MessageEx msg);
        [OperationContract()]
        MessageEx GetFEDMinTimeStamp(MessageEx msg);
        [OperationContract()]
        MessageEx GetFEDMaxTimeStamp(MessageEx msg);
        [OperationContract()]
        MessageEx RegulateFEDCurrentTime(MessageEx msg); 
        [OperationContract()]
        MessageEx GetMessgeOnWallTimeTable(MessageEx msg);
        [OperationContract]
        void DelMessgeOnWallTimeTable(MessageEx msg);        
        /// <summary>
        /// Unsubscribes a client from any message broadcast.
        /// </summary>
        /// <param name="clientId">The client id.</param>
        [OperationContract(IsOneWay = true)]
        void Unsubscribe(string clientId);
        /// <summary>
        /// Keeps the connection between the client and server.
        /// Connection between a client and server has a time-out,
        /// so the client needs to call this before that happens
        /// to remain connected to the server.
        /// </summary>
        [OperationContract(IsOneWay = true)]
        void KeepConnection();  
    }

    public interface IRTIServiceContractCallBack
    {
        /// <summary>
        /// Notifies the client that a guest has joined the party
        /// </summary>
        /// <param name="guestName">Name of the guest</param>
        [OperationContract(IsOneWay = true)]
        void HandleMAMessage(MessageEx msg);
    }
}
